<template>
	<view class="mainBg h100">
		<navbar title="课程详情" />
		<view class="info">
			<image :src="info.imageUrl" mode=""></image>
			<view class="title">
				{{info.name}}
			</view>
			<view class="text">
				{{info.content}}
			</view>
			<view class="bottom">
				<view class="price" v-if="info.free == 0">
					￥{{info.salePrice}} <text>￥{{info.listPrice}}</text>
				</view>
				<view class="price" v-else>
					￥0 <text>￥{{info.listPrice}}</text>
				</view>
				<view class="right">
					{{info.learnTotal}}人正在学
				</view>
			</view>
		</view>
		<!-- <view class="list">
			<view class="title">
				所有课程
			</view>
			<view class="col" v-for="item in info.chapterVoList" :key="item.id">
				<item :item="{}" />
			</view>
		</view> -->
		<view class="payInfo">
			<view class="price" v-if="info.free == 0">
				￥{{info.salePrice}}
			</view>
			<view class="price" v-else>
				免费
			</view>
			<navigator :url="`./confirm?id=`+info.id">
				<view class="btn">
					立即下单
				</view>
			</navigator>
		</view>
		<view class="seat">

		</view>
	</view>
</template>

<script>
	import item from "./item.vue"
	export default {
		components: {
			item
		},
		data() {
			return {
				info: {}
			}
		},
		onLoad(option) {
			this.getInfo(option.id)
		},
		methods: {
			getInfo(id) {
				this.$post("/course/course_detail", {
					id: id
				}).then(res => {
					this.info = res.data
				})
			}
		}
	}
</script>

<style lang="scss">
	.h100 {
		height: 100vh;
	}

	.container {
		background-color: #fff;
		padding: 0 40rpx;
		border-radius: 8rpx;
		margin-bottom: 20rpx;
	}

	.info {
		margin-bottom: 50rpx;
		background-color: #fff;
		padding: 20rpx 40rpx;

		image {
			height: 280rpx;
			border-radius: 8rpx;
		}

		.title {
			font-weight: bold;
			padding: 10rpx 0;
		}

		.text {
			font-size: 28rpx;
			margin: 30rpx 0;
		}

		.bottom {
			display: flex;
			align-items: center;
			justify-content: space-between;
			font-size: 24rpx;
			color: #999;



			.price {
				color: red;
				font-weight: bold;
				font-size: 32rpx;

				text {
					font-size: 24rpx;
					color: #999;
					font-weight: normal;
					text-decoration: line-through;
				}
			}

			.right text {
				font-size: 24rpx;
				padding: 6rpx 10rpx;
				border: 2rpx solid $assist-color2;
				color: $assist-color2;
				border-radius: 100px;
			}
		}
	}

	.list {
		.title {
			font-weight: bold;
			font-size: 28rpx;
			padding: 36rpx 40rpx;
		}

		.col {
			padding: 20rpx 40rpx;
			background-color: #fff;
			border-radius: 8rpx;
			margin: 20rpx 0;
		}
	}

	.statistics {
		padding-top: 10rpx;
		padding-bottom: 10rpx;

		.col {
			display: flex;
			align-items: center;
			justify-content: space-between;
			font-size: 28rpx;
			padding: 20rpx 0;

			.coupon {
				display: flex;
				align-items: center;

				image {
					width: 32rpx;
					height: 32rpx;
					margin-left: 6rpx;
				}
			}

		}
	}

	.payment {
		padding-top: 30rpx;
		padding-bottom: 10rpx;

		.title {
			font-weight: bold;
		}

		.col {
			display: flex;
			align-items: center;
			justify-content: space-between;
			padding: 20rpx 0;

			.left {
				display: flex;
				align-items: center;

				image {
					width: 64rpx;
					height: 64rpx;
				}
			}


			.selected {
				width: 54rpx;
				height: 54rpx;
			}
		}
	}

	.payInfo {
		width: 100%;
		height: 110rpx;
		position: fixed;
		left: 0%;
		bottom: 0;
		background-color: #fff;
		display: flex;
		align-items: center;
		justify-content: space-between;
		padding: 0 40rpx;
		box-shadow: 0 0 20rpx rgba($color: $main-color, $alpha: 0.2);

		.price {
			font-weight: bold;
			color: red;
			font-size: 40rpx;
		}

		.btn {
			background-color: $assist-color2;
			color: #fff;
			font-size: 24rpx;
			text-align: center;
			width: 160rpx;
			line-height: 60rpx;
			border-radius: 8rpx;
		}
	}

	.seat {
		height: 110rpx;
	}
</style>